#include "stm32f10x.h"                  // Device header
#include "OLED.h"
void Button_Config()
{
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE);
	
	GPIO_InitTypeDef GPIO_InitStructure;
	
	GPIO_InitStructure.GPIO_Mode=GPIO_Mode_IPD;
	GPIO_InitStructure.GPIO_Pin=GPIO_Pin_0;
	GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
	GPIO_Init(GPIOA, &GPIO_InitStructure);
	
	GPIO_EXTILineConfig(GPIO_PortSourceGPIOA,GPIO_PinSource0);
	
	EXTI_InitTypeDef EXTI_Structure;
	EXTI_Structure.EXTI_Line=EXTI_Line0;
	EXTI_Structure.EXTI_LineCmd=ENABLE;
	EXTI_Structure.EXTI_Mode=EXTI_Mode_Interrupt;
	EXTI_Structure.EXTI_Trigger=EXTI_Trigger_Falling;
	EXTI_Init(&EXTI_Structure);
	
	NVIC_InitTypeDef NVIC_InitStructure;
	NVIC_InitStructure.NVIC_IRQChannel=EXTI0_IRQn;
	NVIC_InitStructure.NVIC_IRQChannelCmd=ENABLE;
	NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=0;
	NVIC_InitStructure.NVIC_IRQChannelSubPriority=0;
	NVIC_Init(&NVIC_InitStructure);
}
void EXTI0_IRQHandler(void)
{
	if(EXTI_GetITStatus(EXTI_Line0)==SET)
	{
		OLED_ShowString(1,1,"hello");
		EXTI_ClearITPendingBit(EXTI_Line0);//use in interrupt function
	}
}
// misc.h  exti.h stm32f10x.h  startup_stm32f10x_md.s gpio.h